package base.day25;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class Properties1 {
    public static void main(String[] args) {
        Properties prop=new Properties();
        //增
        prop.put("zhangsan",23);
        prop.put("lisi",24);
        prop.put("wangwu",25);
        prop.put("zhaoliu",26);
        System.out.println(prop);
        //删
        prop.remove("zhaoliu");
        System.out.println(prop);
        //改
        prop.put("wangwu",67);
        System.out.println(prop);
        //查
        Object o = prop.get("lisi");
        System.out.println(o);
        //遍历
        Set<Object> keys = prop.keySet();
        for (Object key : keys) {
            System.out.println(prop.get(key));
        }

        Set<Map.Entry<Object, Object>> entries = prop.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            Object key = entry.getKey();
            Object value = entry.getValue();
            System.out.println(key+"="+value);
        }

        prop.setProperty("江西","南昌");
        prop.setProperty("江苏","南京");
        prop.setProperty("安徽","合肥");
        System.out.println(prop);

        String s = prop.getProperty("江西");
        System.out.println(s);

        Set<String> keys1 = prop.stringPropertyNames();
        for (String key : keys1) {
            String value = prop.getProperty(key);
            System.out.println(key+value);

        }



    }
}
